

import urllib.request
import urllib.parse
import lxml.etree

url="https://blog.csdn.net/luxideyao/article/details/77802389"
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0'

}
request = urllib.request.Request(url, headers=headers)
response = urllib.request.urlopen(request)
content = response.read().decode("utf8")
# print(content)
with open("1.html","w",encoding="utf8") as file:
    file.write(content)
html = lxml.etree.HTML(content) # type:lxml.etree._Element
names = html.xpath("//div[@id='asideCategory']/h3[text()='分类专栏']/following-sibling::*[2]/a/img/@src")
print(names)

# print(content)
